package nextel.agps;

import com.motorola.iden.position.AggregatePosition; 
import com.motorola.iden.position.PositionDevice;
import nextel.PropertiesMovil;
import pe.com.nextel.util.Fecha;


public class AGPSBean {
    
    public final static String DELAY_NO = "delay=no";
    public final static String DELAY_LOW = "delay=low";
    public final static String DELAY_HIGH = "delay=high";
    public final static String FIX_EXTENDED = "fix=extended";
    
 //   private String mposition = DELAY_HIGH;
//    private String longitud;
//    private String latitud;
    public int latitude;
    public int longitude;
//    private int numlongitud;
//    private int numlatitud;
    public long timeStamp;
//    private String status;
    //nuevos
    private int altitud;
    public int velocidad;
    public int numSatelites;
    public int exactitudLatLon;
    //public int rumbo;
    public int nivVelocIncerti;
//    private int altitudIncerti;
    public boolean asistUsada;
//    private String latitudCelda;
//    private String longitudCelda;
    // private boolean detectec = false;
    
    /** Constructor de GPSBean */
    public AGPSBean( ) {
    }
    
    public String isAsistUsada( ) {
        return asistUsada ? "S" : "C";  // S: satelite, C: Celda
    }
    
    public void printPosition(AggregatePosition pos) {
        
        if (pos == null) {
            return;
        }

        PropertiesMovil.errorPosicionGPS = 0;

        if ( pos.getResponseCode( ) != PositionDevice.POSITION_OK) {
            PropertiesMovil.errorPosicionGPS = pos.getResponseCode( );
        }
        
      // System.out.println("pos.hasLatLon( )=" + pos.hasLatLon( ));
        
        if (pos.hasLatLon( )) {

            timeStamp = pos.getTimeStamp( );
            latitude = pos.getLatitude( );
            longitude = pos.getLongitude( );
            asistUsada = true;
            
            altitud = pos.getAltitude( );
            
            if (pos.hasSpeedUncertainty( )) {
                velocidad = (pos.getSpeed( ));
                nivVelocIncerti = (pos.getSpeedUncertainty( ));
            }
            
            numSatelites = (pos.getNumberOfSatsUsed( ));
            exactitudLatLon = (pos.getLatLonAccuracy( ));
    
            
            
            
        } //si solo obtuvimos localizaci�n de la celda de servicio
        else {
            asistUsada = false;
            latitude = pos.getServingCellLatitude( );
            longitude = pos.getServingCellLongitude( );
            
        }
        
        //System.out.println("pos.getLatitude( )=" + Fecha.getFechaActualCompleta());

    }
}
